<template>
  <div id="centerLeft1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-bar" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">区三资统计</span>
          <dv-decoration-3 class="dv-dec-3" />
        </div>
      </div>
      <div class="d-flex jc-center">
        <CenterLeft1Chart />
      </div>
      <!-- 4个主要的数据 -->
      <div class="bottom-data">
        <div class="item-box mt-2" v-for="(item, index) in numberData" :key="index">
          <div class="d-flex">
            <dv-digital-flop class="dv-digital-flop" :config="item.number" />
          </div>
          <p class="text" style="text-align: center;">
            {{ item.text }}
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CenterLeft1Chart from '@/components/echart/centerLeft/centerLeft1Chart'
import { queryThreeCapital } from "../api/index.js";
export default {
  data() {
    return {
      numberData: [
        {
          number: {
            number: [15],
            textAlign: 'center',
            content: '{nt}条',
            style: {
              fontSize: 24
            }
          },
          text: '资产'
        },
        {
          number: {
            number: [1144],
            textAlign: 'center',
            content: '{nt}条',
            style: {
              fontSize: 24
            }
          },
          text: '资源'
        },
        {
          number: {
            number: [361],
            textAlign: 'center',
            content: '{nt}条',
            style: {
              fontSize: 24
            }
          },
          text: '资金收入'
        },
        {
          number: {
            number: [157],
            textAlign: 'center',
            content: '{nt}条',
            style: {
              fontSize: 24
            }
          },
          text: '资金支出'
        }
      ]
    }
  },
  components: {
    CenterLeft1Chart
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      let that = this;
      queryThreeCapital().then(res => {
        console.log(res)
        for (let index = 0; index < that.numberData.length; index++) {
          that.numberData[index].number.number = []
        }
        that.numberData[0].number.number.push(res.data.assetNum)
        that.numberData[1].number.number.push(res.data.resourceNum)
        that.numberData[2].number.number.push(Number(res.data.inputNum))
        that.numberData[3].number.number.push(Number(res.data.outputNum))
        for (let index = 0; index < that.numberData.length; index++) {
          that.numberData[index].number = { ...that.numberData[index].number }
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
$box-width: 300px;
$box-height: 410px;

#centerLeft1 {
  padding: 16px;
  height: $box-height;
  width: $box-width;
  border-radius: 10px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .dv-dec-3 {
    position: relative;
    width: 100px;
    height: 20px;
    top: -3px;
  }

  .bottom-data {
    .item-box {
      & > div {
        padding-right: 5px;
      }
      font-size: 14px;
      float: right;
      position: relative;
      width: 50%;
      color: #d3d6dd;
      .dv-digital-flop {
        width: 120px;
        height: 30px;
        text-align: center;
      }
      // 金币
      .coin {
        position: relative;
        top: 6px;
        font-size: 20px;
        color: #ffc107;
      }
      .colorYellow {
        color: yellowgreen;
      }
      p {
        text-align: center;
      }
    }
  }
}
</style>
